package com.javahash.spring.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


@Component
public class Scheduler {

    final static private int interval = 15 * 60 * 1000;

    // final static private int interval =  1000;

    @Autowired
    MongoExchangeRates MongoExchangeRates;


    //Check Exchange Rates API each 15 minutes
    @Scheduled(fixedRate = interval)
    public void updateExchangeRates() {

        MongoExchangeRates.saveApiExchangeRatesToDB();


    }

}
 